/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-08-19     SY       the first version
 */
#include "rtthread.h"
#include "board.h"

#include "sy_rs485.h"
#include "sy_queue.h"
#include "sy_uart.h"
#include "sy_write_thread.h"

#define RS485_EN GET_PIN(A,1)

int Rs485_init()
{
    rt_pin_mode(RS485_EN,PIN_MODE_OUTPUT );
    rt_pin_write(RS485_EN,0);
	
		return 0;
}

void Rs485_Send_Disable()
{
    rt_pin_write(RS485_EN,0);
}
void Rs485_Send_Enable()
{
    rt_pin_write(RS485_EN,1);
}
int Rs485_SendData(unsigned char *data,unsigned int size)
{
    rt_device_t rs485=Get_Rs485Dev();
    if(rs485==RT_NULL)
    {
        return -1;
    }
    return write_push(rs485,data,size);
}
